home *** CD-ROM | disk | FTP | other *** search
/ Aminet 28 / Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso / Aminet / dev / basic / BlitzC2P.lha / blitzc2p / demos / chunkyshape1.ascii < prev    next >
Encoding:
Text File  |  1998-09-13  |  10.9 KB  |  565 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; 040/25 results with objects:
  5.  
  6. ; 320x240 @25fps DoublePAL 120 16x16 objects, masked, no mask data, to any position
  7. ; 320x240 @25fps DoublePAL 330 16x16 objects, unmasked, to any position
  8. ; 320x240 @25fps DoublePAL 245 16x16 objects, masked, with mask data, to any position
  9.  
  10. ; 320x240 @25fps PAL 145 16x16 objects, masked, no mask data, to any position
  11. ; 320x240 @25fps PAL 385 16x16 objects, unmasked, to any position
  12. ; 320x240 @25fps PAL 290 16x16 objects, masked, with mask data, to any position
  13.  
  14. ; 320x240 @25fps PAL 150 16x16 objects, masked, no mask data, to nearest 4 pixels (block4)
  15. ; 320x240 @25fps PAL 410 16x16 objects, unmasked, to nearest 4 pixels (Block4)
  16. ; 320x240 @25fps PAL 320 16x16 objects, masked, with mask data, to nearest 4 pixels (Block4)
  17.  
  18. ; 320x240 @25fps PAL 43  32x32 objects, masked, no mask data, to any position
  19. ; 320x240 @25fps PAL 160 32x32 objects, unmasked, to any position
  20. ; 320x240 @25fps PAL 100 32x32 objects, masked, with mask data, to any position
  21.  
  22. ; 320x240 @25fps PAL 44  32x32 objects, masked, no mask data, to nearest 4 pixels (Block4)
  23. ; 320x240 @25fps PAL 170 32x32 objects, unmasked, to nearest 4 pixels (Block4)
  24. ; 320x240 @25fps PAL 113 32x32 objects, masked, with mask data, to nearest 4 pixels (Block4)
  25.  
  26.  
  27. ; 040/25 c2p results:
  28.  
  29. ; 320x200 @49.65fps DoublePAL or 55.3fps PAL
  30. ; 320x256 @36.2fps DoublePAL or 42.5fps PAL
  31. ; 320x240 @39.5fps DoublePAL or 45.5fps PAL
  32.  
  33. ; 060/50 c2p results:
  34.  
  35. ; 320x256 @50fps PAL
  36. ; 320x200 @66.1fps PAL
  37.  
  38. #c2pBPLX=320
  39. #c2pBPLY=240
  40. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  41.  
  42. #scrwidth=#c2pBPLX
  43. #scrheight=#c2pBPLY
  44. #screensize=#scrwidth*#scrheight
  45.  
  46. #objwidth=8
  47. #objheight=8
  48. #objxalign=$ffff
  49. #objcount=100
  50. #objtype=3
  51. #objlongwidth=#objwidth/4
  52.  
  53. ; c2p1x1_8_c5_040
  54.  
  55. ; 110% on 040-25
  56.  
  57. Statement c2p040onlyinit{A.l,B.l}
  58.  
  59.   ;A.l=d0=Width.w
  60.   ;B.l=d1=Height.w
  61.  
  62. ; d0.w  chunkyx [chunky-pixels]
  63. ; d1.w  chunkyy [chunky-pixels]
  64. ; d3.w  scroffsy [screen-pixels]
  65.  
  66. c2p1x1_8_c5_040_init
  67.   LEA c2p_datanew(pc),a0
  68.   ANDI.l  #$ffff,d0
  69.   MULU.w  d0,d3
  70.   LSR.l #3,d3
  71.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  72.   MULU.w  d0,d1
  73.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  74. AsmExit
  75. End Statement
  76.  
  77. Statement c2p040only{A.l,B.l}
  78.  
  79.   MOVE.l  d0,a0 ; Chunky
  80.   MOVE.l  d1,a1 ; Planar
  81.  
  82. ; a0  c2pscreen
  83. ; a1  bitplanes
  84.  
  85. c2p1x1_8_c5_040
  86.   MOVEM.l a3-a6,-(a7)
  87.  
  88.   MOVEM.l a0-a1,-(a7)
  89.   LEA c2p_datanew,a0
  90.   LEA c2p_data,a1
  91.   MOVEQ #16-1,d0
  92. _c2pcopy: MOVE.l  (a0)+,(a1)+
  93.   DBF d0,_c2pcopy
  94.   MOVEM.l (a7)+,a0-a1
  95.   MOVE.l  a7,stackstore
  96.   MOVE.l  #0,a7
  97.   LEA c2p_data(pc),a2
  98.  
  99.   MOVE.l  c2p_pixels-c2p_data(a2),a3
  100.   ADD.l a0,a3
  101.  
  102.   ADD.w #c2pBPLSIZE,a1
  103.   ADD.l c2p_scroffs-c2p_data(a2),a1
  104.   MOVE.l  a1,a2
  105.   ADD.l #c2pBPLSIZE*4,a2
  106.  
  107.   MOVE.l  (a0),d0
  108.   MOVE.l  a7,(a0)+
  109.   MOVE.l  (a0),d1
  110.   MOVE.l  a7,(a0)+
  111.   MOVE.l  (a0),d2
  112.   MOVE.l  a7,(a0)+
  113.   MOVE.l  (a0),d3
  114.   MOVE.l  a7,(a0)+
  115.   MOVE.l  (a0),d4
  116.   MOVE.l  a7,(a0)+
  117.   MOVE.l  (a0),d5
  118.   MOVE.l  a7,(a0)+
  119.  
  120.   MOVE.l  d4,d7     ; Swap 16x4, part 1
  121.   MOVE.w  d0,d4
  122.   SWAP  d4
  123.   MOVE.w  d4,d0
  124.   MOVE.w  d7,d4
  125.   MOVE.l  d5,d7
  126.   MOVE.w  d1,d5
  127.   SWAP  d5
  128.   MOVE.w  d5,d1
  129.   MOVE.w  d7,d5
  130.  
  131.   MOVE.l  d4,d7     ; Swap 2x4, part 1
  132.   LSR.l #2,d7
  133.   EOR.l d0,d7
  134.   AND.l #$33333333,d7
  135.   EOR.l d7,d0
  136.   LSL.l #2,d7
  137.   EOR.l d7,d4
  138.   MOVE.l  d5,d7
  139.   LSR.l #2,d7
  140.   EOR.l d1,d7
  141.   AND.l #$33333333,d7
  142.   EOR.l d7,d1
  143.   LSL.l #2,d7
  144.   EOR.l d7,d5
  145.  
  146.   MOVE.l  (a0),a5
  147.   MOVE.l  a7,(a0)+
  148.   MOVE.l  (a0),a6
  149.   MOVE.l  a7,(a0)+
  150.  
  151.   EXG d4,a5
  152.   EXG d5,a6
  153.  
  154.   MOVE.l  d4,d7     ; Swap 16x4, part 2
  155.   MOVE.w  d2,d4
  156.   SWAP  d4
  157.   MOVE.w  d4,d2
  158.   MOVE.w  d7,d4
  159.   MOVE.l  d5,d7
  160.   MOVE.w  d3,d5
  161.   SWAP  d5
  162.   MOVE.w  d5,d3
  163.   MOVE.w  d7,d5
  164.  
  165.   MOVE.l  d4,d7     ; Swap 2x4, part 2
  166.   LSR.l #2,d7
  167.   EOR.l d2,d7
  168.   AND.l #$33333333,d7
  169.   EOR.l d7,d2
  170.   LSL.l #2,d7
  171.   EOR.l d7,d4
  172.   MOVE.l  d5,d7
  173.   LSR.l #2,d7
  174.   EOR.l d3,d7
  175.   AND.l #$33333333,d7
  176.   EOR.l d7,d3
  177.   LSL.l #2,d7
  178.   EOR.l d7,d5
  179.  
  180.   MOVE.l  d1,d7     ; Swap 4x1
  181.   LSR.l #4,d7
  182.   EOR.l d0,d7
  183.   AND.l #$0f0f0f0f,d7
  184.   EOR.l d7,d0
  185.   LSL.l #4,d7
  186.   EOR.l d7,d1
  187.   MOVE.l  d3,d7
  188.   LSR.l #4,d7
  189.   EOR.l d2,d7
  190.   AND.l #$0f0f0f0f,d7
  191.   EOR.l d7,d2
  192.   LSL.l #4,d7
  193.   EOR.l d7,d3
  194.  
  195.   BRA _start
  196. _x
  197.   MOVE.l  (a0),d0
  198.   MOVE.l  a7,(a0)+
  199.   MOVE.l  (a0),d1
  200.   MOVE.l  a7,(a0)+
  201.   MOVE.l  (a0),d2
  202.   MOVE.l  a7,(a0)+
  203.   MOVE.l  (a0),d3
  204.   MOVE.l  a7,(a0)+
  205.   MOVE.l  (a0),d4
  206.   MOVE.l  a7,(a0)+
  207.   MOVE.l  (a0),d5
  208.   MOVE.l  a7,(a0)+
  209.  
  210.   MOVE.l  a6,-c2pBPLSIZE(a1)
  211.  
  212.   MOVE.l  d4,d7     ; Swap 16x4, part 1
  213.   MOVE.w  d0,d4
  214.   SWAP  d4
  215.   MOVE.w  d4,d0
  216.   MOVE.w  d7,d4
  217.   MOVE.l  d5,d7
  218.   MOVE.w  d1,d5
  219.   SWAP  d5
  220.   MOVE.w  d5,d1
  221.   MOVE.w  d7,d5
  222.  
  223.   MOVE.l  d4,d7     ; Swap 2x4, part 1
  224.   LSR.l #2,d7
  225.   EOR.l d0,d7
  226.   AND.l #$33333333,d7
  227.   EOR.l d7,d0
  228.   LSL.l #2,d7
  229.   EOR.l d7,d4
  230.   MOVE.l  d5,d7
  231.   LSR.l #2,d7
  232.   EOR.l d1,d7
  233.   AND.l #$33333333,d7
  234.   EOR.l d7,d1
  235.   LSL.l #2,d7
  236.   EOR.l d7,d5
  237.  
  238.   MOVE.l  (a0),d7
  239.   MOVE.l  a7,(a0)+
  240.   MOVE.l  (a0),a6
  241.   MOVE.l  a7,(a0)+
  242.  
  243.   MOVE.l  a5,-c2pBPLSIZE(a2)
  244.  
  245.   MOVE.l  d7,a5
  246.   EXG d4,a5
  247.   EXG d5,a6
  248.  
  249.   MOVE.l  d4,d7     ; Swap 16x4, part 2
  250.   MOVE.w  d2,d4
  251.   SWAP  d4
  252.   MOVE.w  d4,d2
  253.   MOVE.w  d7,d4
  254.   MOVE.l  d5,d7
  255.   MOVE.w  d3,d5
  256.   SWAP  d5
  257.   MOVE.w  d5,d3
  258.   MOVE.w  d7,d5
  259.  
  260.   MOVE.l  d4,d7     ; Swap 2x4, part 2
  261.   MOVE.l  d6,(a2)+
  262.   LSR.l #2,d7
  263.   EOR.l d2,d7
  264.   AND.l #$33333333,d7
  265.   EOR.l d7,d2
  266.   LSL.l #2,d7
  267.   EOR.l d7,d4
  268.   MOVE.l  d5,d7
  269.   LSR.l #2,d7
  270.   EOR.l d3,d7
  271.   AND.l #$33333333,d7
  272.   EOR.l d7,d3
  273.   LSL.l #2,d7
  274.   EOR.l d7,d5
  275.  
  276.   MOVE.l  d1,d7     ; Swap 4x1
  277.   LSR.l #4,d7
  278.   EOR.l d0,d7
  279.   MOVE.l  a4,(a1)+
  280.   AND.l #$0f0f0f0f,d7
  281.   EOR.l d7,d0
  282.   LSL.l #4,d7
  283.   EOR.l d7,d1
  284.   MOVE.l  d3,d7
  285.   LSR.l #4,d7
  286.   EOR.l d2,d7
  287.   AND.l #$0f0f0f0f,d7
  288.   EOR.l d7,d2
  289.   LSL.l #4,d7
  290.   EOR.l d7,d3
  291. _start
  292.  
  293.   MOVE.l  d2,d7     ; Swap 8x2, part 1
  294.   LSR.l #8,d7
  295.   EOR.l d0,d7
  296.   AND.l #$00ff00ff,d7
  297.   EOR.l d7,d0
  298.   LSL.l #8,d7
  299.   EOR.l d7,d2
  300.   MOVE.l  d2,d7
  301.   LSR.l #1,d7     ; Swap 1x2, part 1
  302.   EOR.l d0,d7
  303.   AND.l #$55555555,d7
  304.   EOR.l d7,d0
  305.   MOVE.l  d0,c2pBPLSIZE*2(a2)
  306.   ADD.l d7,d7
  307.   EOR.l d7,d2
  308.   MOVE.l  d3,d7     ; Swap 8x2, part 2
  309.   LSR.l #8,d7
  310.   EOR.l d1,d7
  311.   AND.l #$00ff00ff,d7
  312.   EOR.l d7,d1
  313.   LSL.l #8,d7
  314.   EOR.l d7,d3
  315.   MOVE.l  d3,d7
  316.   LSR.l #1,d7     ; Swap 1x2, part 2
  317.   EOR.l d1,d7
  318.   AND.l #$55555555,d7
  319.   EOR.l d7,d1
  320.   MOVE.l  d1,c2pBPLSIZE*2(a1)
  321.   ADD.l d7,d7
  322.   EOR.l d7,d3
  323.  
  324.   MOVE.l  d5,d7
  325.   LSR.l #4,d7
  326.   EOR.l d4,d7
  327.   AND.l #$0f0f0f0f,d7
  328.   EOR.l d7,d4
  329.   LSL.l #4,d7
  330.   EOR.l d7,d5
  331.  
  332.   EXG d4,a5
  333.   EXG d5,a6
  334.  
  335.   MOVE.l  d5,d7
  336.   LSR.l #4,d7
  337.   EOR.l d4,d7
  338.   AND.l #$0f0f0f0f,d7
  339.   EOR.l d7,d4
  340.   LSL.l #4,d7
  341.   EOR.l d7,d5
  342.  
  343.   MOVE.l  a5,d0
  344.   MOVE.l  a6,d1
  345.   MOVE.l  d2,c2pBPLSIZE(a2)
  346.  
  347.  
  348.   MOVE.l  d0,d7     ; Swap 8x2, part 3
  349.   LSR.l #8,d7
  350.   EOR.l d4,d7
  351.   AND.l #$00ff00ff,d7
  352.   EOR.l d7,d4
  353.   LSL.l #8,d7
  354.   EOR.l d7,d0
  355.   MOVE.l  d0,d7
  356.   LSR.l #1,d7     ; Swap 1x2, part 3
  357.   EOR.l d4,d7
  358.   AND.l #$55555555,d7
  359.   EOR.l d7,d4
  360.   ADD.l d7,d7
  361.   EOR.l d7,d0
  362.   MOVE.l  d1,d7     ; Swap 8x2, part 4
  363.   LSR.l #8,d7
  364.   MOVE.l  d3,c2pBPLSIZE(a1)
  365.   EOR.l d5,d7
  366.   AND.l #$00ff00ff,d7
  367.   EOR.l d7,d5
  368.   LSL.l #8,d7
  369.   EOR.l d7,d1
  370.   MOVE.l  d1,d7
  371.   LSR.l #1,d7     ; Swap 1x2, part 4
  372.   EOR.l d5,d7
  373.   AND.l #$55555555,d7
  374.   EOR.l d7,d5
  375.   ADD.l d7,d7
  376.   EOR.l d7,d1
  377.  
  378.   MOVE.l  d0,a5
  379.   MOVE.l  d1,a6
  380.  
  381.   MOVE.l  d4,d6
  382.   MOVE.l  d5,a4
  383.  
  384.   CMP.l a0,a3
  385.   BNE _x
  386.  
  387.   MOVE.l  a6,-c2pBPLSIZE(a1)
  388.   MOVE.l  a5,-c2pBPLSIZE(a2)
  389.   MOVE.l  d6,(a2)+
  390.   MOVE.l  a4,(a1)+
  391.   MOVE.l  stackstore(pc),a7
  392.   MOVEM.l (a7)+,a3-a6
  393. AsmExit
  394.  
  395.   Even4
  396. stackstore: Dc.l 0
  397. c2p_data
  398. c2p_scroffs: Dc.l 0
  399. c2p_pixels: Dc.l 0
  400.   Ds.l  16
  401.   Even4
  402. c2p_datanew
  403.   Ds.l  16
  404. End Statement
  405.  
  406. Statement chunkyshape1{A.l,B.l,C.l,D.l}
  407. .chunkyshape1
  408. ;32x32 any position masked on the fly
  409.   MULU    #320,d3
  410.   MOVE.l  d0,a0
  411.   ADD.l   d2,d3
  412.   ADD.l   d3,d1
  413.   MOVE.l  d1,a1
  414.   MOVEQ.l #objwidth-1,d2 ; d2=yloop
  415.   MOVEQ.l #8,d5 ; temp for speed
  416. yloop
  417.   MOVEQ.l #objlongwidth-1,d3 ; xloop
  418. xloop
  419.     MOVE.l  (a0),d6 ; Store gfx (cache?)
  420.     MOVE.b  (a0)+,d4 ; source
  421.     SEQ.b   d4    ; mask
  422.     ROL.l   d5,d4 ; rotate
  423.     MOVE.b  (a0)+,d4 ; source
  424.     SEQ.b   d4    ; mask
  425.     ROL.l   d5,d4 ; rotate
  426.     MOVE.l  (a1),d7 ; get dest
  427.     MOVE.b  (a0)+,d4 ; source
  428.     SEQ.b   d4    ; mask
  429.     ROL.l   d5,d4 ; rotate
  430.     MOVE.b  (a0)+,d4 ; source
  431.     SEQ.b   d4    ; mask
  432.     ROL.l   d5,d4 ; rotate
  433.     AND.l   d4,d7 ; cut
  434.     OR.l    d6,d7 ; paste
  435.     MOVE.l  d7,(a1)+ ; Output
  436.     DBRA    d3,xloop
  437.   ADD.l   #320-32,a1 ; line modulo
  438.   DBRA    d2,yloop
  439.   AsmExit
  440. End Statement
  441.  
  442. Statement chunkyshape2{A.l,B.l,C.l,D.l}
  443. .chunkyshape2
  444. ;32x32 any position non-masked
  445.   MULU    #320,d3
  446.   MOVE.l  d0,a0
  447.   ADD.l   d2,d3
  448.   ADD.l   d3,d1
  449.   MOVE.l  d1,a1
  450.   MOVEQ.l #objwidth-1,d2
  451.   MOVEQ.l #8,d5
  452.   MOVE.l  #320-objwidth,d3
  453. yloop2
  454.   MOVEQ.l #objlongwidth-1,d4
  455. xloop2
  456.     MOVE.l  (a0)+,(a1)+
  457.     DBRA    d4,xloop2
  458.   ADD.l   d3,a1
  459.   DBRA    d2,yloop2
  460. AsmExit
  461. End Statement
  462.  
  463. Statement chunkyshape3{A.l,B.l,C.l,D.l,E.l}
  464. .chunkyshape3
  465. ;32x32 any position masked with mask data
  466. ;needs Bank(3) as the second param
  467.   MULU    #320,d4
  468.   MOVE.l  d0,a0 ; input
  469.   ADD.l   d3,d4
  470.   MOVE.l  d1,a2 ; mask
  471.   ADD.l   d4,d2
  472.   MOVE.l  d2,a1 ; output
  473.   MOVEQ.l #objwidth-1,d2
  474.   MOVE.l  #320-objwidth,d3
  475. yloop3
  476.   MOVEQ.l #objlongwidth-1,d4
  477. xloop3
  478.     MOVE.l  (a2)+,d0
  479.     AND.l   d0,(a1)
  480.     MOVE.l  (a0)+,d1
  481.     OR.l    d1,(a1)+
  482.     DBRA    d4,xloop3
  483.   ADD.l   d3,a1
  484.   DBRA    d2,yloop3
  485. AsmExit
  486. End Statement
  487.  
  488. .blitzprogram
  489. ; Setup
  490. InitBank 1,#scrwidth*#scrheight,$10000 ; Fastram chunky buffer
  491. InitPalette 0,256
  492. For c=1 To 255 : AGAPalRGB 0,c,Rnd(255),Rnd(255),Rnd(255) : Next c
  493. AGAPalRGB 0,0,0,0,0
  494. VWait
  495. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  496. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  497. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  498. Use Palette 0
  499. VWait 50
  500.  
  501. ; chunky shape
  502. InitBank 2,#objwidth*#objheight,$10000 ; chunky shape
  503. For o=0 To (#objwidth*#objheight)-1
  504.   Poke.b Bank(2)+o,Rnd(255)
  505. Next o
  506.  
  507. ; chunky mask
  508. InitBank 3,#objwidth*#objheight,$10000 ; chunky mask
  509. For o=0 To (#objwidth*#objheight)-1
  510.   If Peek.b(Bank(2)+o)=0 Then Poke.b Bank(3)+o,$ff Else Poke.b Bank(3)+o,$0
  511. Next o
  512.  
  513. ; Do the c2p test
  514. c2p040onlyinit{#scrwidth,#scrheight}
  515. VWait 20
  516. Forbid_
  517. VWait
  518. If #objtype=1
  519.   ResetTimer
  520.   For time=1 To 200
  521.     For cs=1 To #objcount
  522.       chunkyshape1{Bank(2),Bank(1),Rnd(#scrwidth-#objwidth-4)&#objxalign,Rnd(#scrheight-#objheight-4)}
  523.     Next cs
  524.     c2p040only{Bank(1),Bank(0)} ; Convert chunky to planar
  525.   Next time
  526.   t=Ticks
  527. Else
  528.   If #objtype=2
  529.     ResetTimer
  530.     For time=1 To 200
  531.       For cs=1 To #objcount
  532.         chunkyshape2{Bank(2),Bank(1),Rnd(#scrwidth-#objwidth-4)&#objxalign,Rnd(#scrheight-#objheight-4)}
  533.       Next cs
  534.       c2p040only{Bank(1),Bank(0)} ; Convert chunky to planar
  535.     Next time
  536.     t=Ticks
  537.   Else
  538.     If #objtype=3
  539.       ResetTimer
  540.       For time=1 To 200
  541.         For cs=1 To #objcount
  542.           chunkyshape3{Bank(2),Bank(3),Bank(1),Rnd(#scrwidth-#objwidth-4)&#objxalign,Rnd(#scrheight-#objheight-4)}
  543.         Next cs
  544.         c2p040only{Bank(1),Bank(0)} ; Convert chunky to planar
  545.       Next time
  546.       t=Ticks
  547.     EndIf
  548.   EndIf
  549. EndIf
  550.  
  551. VWait 2 : Permit_
  552. VWait 20
  553. FindScreen 0
  554. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  555. WindowOutput 0
  556. per.f=1/(t/200)
  557. NPrint "Routine performed @ ",50/(t/200),"fps - ",t," ticks - ",per," per frame"
  558. NPrint " "
  559. NPrint "Press mousebutton..."
  560. Free Screen 0
  561. MouseWait
  562. Free Window 0
  563. End
  564.  
  565.